package com.yuedao.sender.model1;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * AssistDemo
 * com.chris.demo.model.orm
 * Created by Chris Chen
 * 2018/1/5
 * Explain:
 */
@Entity(name = "ydx_journeys")
public class JourneyEntity {
    private int id;
    private int orderId;
    private int orderTypeId;
    private Integer airportId;
    private Integer airportServiceType;
    private Timestamp airportServiceTime;
    private String flightNo;
    private String startPlace;
    private int startLongitude;
    private int startLatitude;
    private String endPlace;
    private int endLongitude;
    private int endLatitude;
    private Integer waitingTime;
    private double distance;
    private int orderPrice;
    private String description;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "order_id", nullable = false)
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "order_type_id", nullable = false)
    public int getOrderTypeId() {
        return orderTypeId;
    }

    public void setOrderTypeId(int orderTypeId) {
        this.orderTypeId = orderTypeId;
    }

    @Basic
    @Column(name = "airport_id", nullable = true)
    public Integer getAirportId() {
        return airportId;
    }

    public void setAirportId(Integer airportId) {
        this.airportId = airportId;
    }

    @Basic
    @Column(name = "airport_service_type", nullable = true)
    public Integer getAirportServiceType() {
        return airportServiceType;
    }

    public void setAirportServiceType(Integer airportServiceType) {
        this.airportServiceType = airportServiceType;
    }

    @Basic
    @Column(name = "airport_service_time", nullable = false)
    public Timestamp getAirportServiceTime() {
        return airportServiceTime;
    }

    public void setAirportServiceTime(Timestamp airportServiceTime) {
        this.airportServiceTime = airportServiceTime;
    }

    @Basic
    @Column(name = "flight_no", nullable = true, length = 32)
    public String getFlightNo() {
        return flightNo;
    }

    public void setFlightNo(String flightNo) {
        this.flightNo = flightNo;
    }

    @Basic
    @Column(name = "start_place", nullable = false, length = 1024)
    public String getStartPlace() {
        return startPlace;
    }

    public void setStartPlace(String startPlace) {
        this.startPlace = startPlace;
    }

    @Basic
    @Column(name = "start_longitude", nullable = false)
    public int getStartLongitude() {
        return startLongitude;
    }

    public void setStartLongitude(int startLongitude) {
        this.startLongitude = startLongitude;
    }

    @Basic
    @Column(name = "start_latitude", nullable = false)
    public int getStartLatitude() {
        return startLatitude;
    }

    public void setStartLatitude(int startLatitude) {
        this.startLatitude = startLatitude;
    }

    @Basic
    @Column(name = "end_place", nullable = false, length = 1024)
    public String getEndPlace() {
        return endPlace;
    }

    public void setEndPlace(String endPlace) {
        this.endPlace = endPlace;
    }

    @Basic
    @Column(name = "end_longitude", nullable = false)
    public int getEndLongitude() {
        return endLongitude;
    }

    public void setEndLongitude(int endLongitude) {
        this.endLongitude = endLongitude;
    }

    @Basic
    @Column(name = "end_latitude", nullable = false)
    public int getEndLatitude() {
        return endLatitude;
    }

    public void setEndLatitude(int endLatitude) {
        this.endLatitude = endLatitude;
    }

    @Basic
    @Column(name = "waiting_time", nullable = true)
    public Integer getWaitingTime() {
        return waitingTime;
    }

    public void setWaitingTime(Integer waitingTime) {
        this.waitingTime = waitingTime;
    }

    @Basic
    @Column(name = "distance", nullable = false, precision = 2)
    public double getDistance() {
        return distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    @Basic
    @Column(name = "order_price", nullable = false)
    public int getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(int orderPrice) {
        this.orderPrice = orderPrice;
    }

    @Basic
    @Column(name = "description", nullable = true, length = 2048)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        JourneyEntity that = (JourneyEntity) o;

        if (id != that.id) return false;
        if (orderId != that.orderId) return false;
        if (orderTypeId != that.orderTypeId) return false;
        if (startLongitude != that.startLongitude) return false;
        if (startLatitude != that.startLatitude) return false;
        if (endLongitude != that.endLongitude) return false;
        if (endLatitude != that.endLatitude) return false;
        if (Double.compare(that.distance, distance) != 0) return false;
        if (orderPrice != that.orderPrice) return false;
        if (airportId != null ? !airportId.equals(that.airportId) : that.airportId != null) return false;
        if (airportServiceType != null ? !airportServiceType.equals(that.airportServiceType) : that.airportServiceType != null)
            return false;
        if (airportServiceTime != null ? !airportServiceTime.equals(that.airportServiceTime) : that.airportServiceTime != null)
            return false;
        if (flightNo != null ? !flightNo.equals(that.flightNo) : that.flightNo != null) return false;
        if (startPlace != null ? !startPlace.equals(that.startPlace) : that.startPlace != null) return false;
        if (endPlace != null ? !endPlace.equals(that.endPlace) : that.endPlace != null) return false;
        if (waitingTime != null ? !waitingTime.equals(that.waitingTime) : that.waitingTime != null) return false;
        if (description != null ? !description.equals(that.description) : that.description != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = id;
        result = 31 * result + orderId;
        result = 31 * result + orderTypeId;
        result = 31 * result + (airportId != null ? airportId.hashCode() : 0);
        result = 31 * result + (airportServiceType != null ? airportServiceType.hashCode() : 0);
        result = 31 * result + (airportServiceTime != null ? airportServiceTime.hashCode() : 0);
        result = 31 * result + (flightNo != null ? flightNo.hashCode() : 0);
        result = 31 * result + (startPlace != null ? startPlace.hashCode() : 0);
        result = 31 * result + startLongitude;
        result = 31 * result + startLatitude;
        result = 31 * result + (endPlace != null ? endPlace.hashCode() : 0);
        result = 31 * result + endLongitude;
        result = 31 * result + endLatitude;
        result = 31 * result + (waitingTime != null ? waitingTime.hashCode() : 0);
        temp = Double.doubleToLongBits(distance);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + orderPrice;
        result = 31 * result + (description != null ? description.hashCode() : 0);
        return result;
    }
}
